//
//  LZPictureRejectCollectionReusableView.m
//  laziz_Merchant
//
//  Created by XMac on 17/3/14.
//  Copyright © 2017年 XBN. All rights reserved.
//

#import "LZPictureRejectCollectionReusableView.h"
#import "LZRestaurantAuthRejectedView.h"
#import "Masonry.h"


@interface LZPictureRejectCollectionReusableView ()

@property (strong, nonatomic) LZRestaurantAuthRejectedView *rejectedView;

@end

@implementation LZPictureRejectCollectionReusableView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.rejectedView];
        
        [self.rejectedView makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(UIEdgeInsetsMake(0, 0, 0, 0));
        }];
    }
    return self;
}

+(CGSize)getCurrentSizeWithReason:(NSString *)deleteReason
{
    LZRestaurantAuthRejectedView *v = [[NSBundle mainBundle] loadNibNamed:@"LZRestaurantAuthRejectedView" owner:self options:nil].lastObject;
    [v loadReasonText:deleteReason titleText:LZLocalizedString(@"message_eason_for_deletion", nil)];
    
    return CGSizeMake(v.intrinsicContentSize.width, v.intrinsicContentSize.height);
}

-(LZRestaurantAuthRejectedView *)rejectedView{
    if (!_rejectedView) {
        _rejectedView = [[NSBundle mainBundle] loadNibNamed:@"LZRestaurantAuthRejectedView" owner:self options:nil].lastObject;
        [_rejectedView loadReasonText:@"" titleText:LZLocalizedString(@"message_eason_for_deletion", nil)];
    }
    return _rejectedView;
}


-(void)loadReasonText:(NSString *)text{
    if (!text) {
        return;
    }
    [self.rejectedView loadReasonText:text titleText:LZLocalizedString(@"message_eason_for_deletion", nil)];
}

@end
